<?php

/**
 * ReglementClient form base class.
 *
 * @method ReglementClient getObject() Returns the current form's model object
 *
 * @package    SdCommerce
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseReglementClientForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'date'              => new sfWidgetFormDate(),
      'reference'         => new sfWidgetFormInputText(),
      'client_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Client'), 'add_empty' => true)),
      'departement_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'id_representant'   => new sfWidgetFormInputText(),
      'confirme'          => new sfWidgetFormInputCheckbox(),
      'valider'           => new sfWidgetFormInputCheckbox(),
      'brouillon'         => new sfWidgetFormInputCheckbox(),
      'contact_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'add_empty' => true)),
      'etat_reglement'    => new sfWidgetFormInputCheckbox(),
      'id_caisse_session' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SessionCaisse'), 'add_empty' => true)),
      'montant_total'     => new sfWidgetFormInputText(),
      'created_at'        => new sfWidgetFormDateTime(),
      'updated_at'        => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'date'              => new sfValidatorDate(),
      'reference'         => new sfValidatorString(array('max_length' => 20)),
      'client_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Client'), 'required' => false)),
      'departement_id'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'required' => false)),
      'id_representant'   => new sfValidatorInteger(array('required' => false)),
      'confirme'          => new sfValidatorBoolean(array('required' => false)),
      'valider'           => new sfValidatorBoolean(array('required' => false)),
      'brouillon'         => new sfValidatorBoolean(array('required' => false)),
      'contact_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Contact'), 'required' => false)),
      'etat_reglement'    => new sfValidatorBoolean(array('required' => false)),
      'id_caisse_session' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SessionCaisse'), 'required' => false)),
      'montant_total'     => new sfValidatorNumber(array('required' => false)),
      'created_at'        => new sfValidatorDateTime(),
      'updated_at'        => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('reglement_client[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ReglementClient';
  }

}
